package com.gr.catanddog_common.springConfig;

/**
 * @author 大睡大唬
 * @version 1.0
 * @description: TODO
 * @date 2024/3/7 18:17
 */
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowedMethods("GET", "POST", "PUT", "DELETE")
                .allowedHeaders("token", "Content-Type")
                .allowCredentials(false)
                .maxAge(3600);
    }
}
